#!/usr/bin/env python3

"""
使用多线程计算1000-6000之间回文数的个数
要求使用multiprocessing的pool模块
"""

import multiprocessing


def huiwen(num):
    """
    判断回文数,是回文数则返回,不是则返回None
    """
    str_num = str(num)
    if str_num == str_num[::-1]:
        print(num)

def main():
    """
    多线程实现1000-6000之间回文数的判断
    """
    m_p = multiprocessing.Pool(10)
    res = []
    for i in range(1000, 6000):
        res.append(m_p.apply_async(huiwen, args=(i,)))

    m_p.close()
    m_p.join()


if __name__ == "__main__":
    main()
